<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <script>
    function pow1(x, n) {
      return x ** n
    }
    console.log(pow1(2, 3))
    console.log(pow1(3, 3))
    console.log(Math.pow(3, 3))

    function pow2(x, n) {
      var result = 1
      for (var i = 0; i < n; i++) {
        result *= x
      }
      return result
    }
    console.log(pow2(2, 3))
    console.log(pow2(3, 3))

    function pow(x, n) {
      if (n === 0) return 1
      return x * pow(x, n - 1)
    }
    console.log(pow(2, 3))
    console.log(pow(3, 3))

  </script>
</body>

</html>